const tableColumns = [
  {
    title: 'SKU编码',
    key: 'skuNo'
  },
  {
    title: '商品名称',
    key: 'productName'
  },
  {
    title: '品牌',
    key: 'brandName'
  },
  {
    title: '规格属性ID',
    key: 'attrUuid'
  },
  {
    title: '规格属性名称',
    key: 'attrName'
  },
  {
    title: '属性值',
    children: [
      {
        title: '原值',
        key: 'valueName'
      },
      {
        title: '现值',
        key: 'valueNameUpdate',
        type: 'input'
      }
    ]
  },
  {
    title: '操作',
    key: 'action',
    align: 'center',
    fixed: 'right'
  }
];

const viewTableColumns = [
  {
    title: 'SKU编码',
    key: 'skuNo'
  },
  {
    title: '商品名称',
    key: 'productName'
  },
  {
    title: '品牌',
    key: 'brandName'
  },
  {
    title: '规格属性ID',
    key: 'attrUuid'
  },
  {
    title: '规格属性名称',
    key: 'attrName'
  },
  {
    title: '属性值',
    children: [
      {
        title: '原值',
        key: 'valueName'
      },
      {
        title: '现值',
        key: 'valueNameUpdate',
        type: 'input',
        render: (h, { row }) => {
          const oldVal = row.valueName;
          const newVal = row.valueNameUpdate;
          const isDiff = oldVal != newVal;
          return <span class={ isDiff ? 'error_color' : '' }>{newVal}</span>
        }
      }
    ]
  }
];

const LAUNCH_REASON_OPTIONS = [
  {
    label: '完善销售属性',
    value: '1'
  },
  {
    label: '去除不应展示参数',
    value: '2'
  },
  {
    label: '更改原参数',
    value: '3'
  },
  {
    label: '其它原因',
    value: '4'
  }
];

export {
  tableColumns,
  viewTableColumns,
  LAUNCH_REASON_OPTIONS,
};
